package com.qyhl.module_activities.act.player.detail;


import com.qyhl.webtv.commonlib.entity.act.PlayerVOBean;

/**
 * Created by helin on 2018/1/16.
 */

public class PlayerDetailPresenter  implements PlayerDetailContract.PlayerDetailPresenter{


    private final PlayerDetailContract.PlayerDetailView mView;
    private final PlayerDetailModel model;

    PlayerDetailPresenter(PlayerDetailContract.PlayerDetailView view){
        this.mView =view;
        this.model = new PlayerDetailModel(this);
    }

    @Override
    public void onError(int i, String msg) {
        if(i==1){
            mView.onError(msg);
        }else{
            mView.onVoteError(msg);
        }
    }

    @Override
    public void onSuccess(PlayerVOBean data) {
        mView.onSuccess(data);
    }

    @Override
    public void getPlayerDeatil(String playerId) {
        model.getPlayerDetail(playerId);
    }

    @Override
    public void vote(Integer actId, String phoneNum, Integer playerId) {
        model.vote(actId,phoneNum,playerId);
    }

    @Override
    public void onVoteSuccess() {
        mView.voteSuccess();
    }

}
